import request from "@/utils/request"
import {qsStringify} from "@/utils/common"

enum Api {
	// 查询液位上下限
	selectCustom2DataByDevId = "/custom2Data/selectByDevId",
	// 修改液位上下限
	editCustom2DataById = "/custom2Data/editById"
}

// // 查询液位上下限的Api
// export const selectCustom2DataByDevIdApi = (data: {devId: number | string | null}) => {
// 	let dataQ = "?" + qsStringify(data)
// 	return request.get(Api.selectCustom2DataByDevId + dataQ)
// }

// // 修改液位上下限的Api
// export const editCustom2DataByDevIdApi = (data: {
// 	customData2Id: number | string | null
// 	highLimit: number | string | null
// 	lowerLimit: number | string | null
// }) => {
// 	let dataQ = "?" + qsStringify(data)
// 	return request.get(Api.editCustom2DataById + dataQ)
// }

// 读取状态的Api
export const readStatusApi = (data: {devGId: number | string | null}) => {
	let dataQ = "?" + qsStringify(data)
	return request.get("/exc/readStatus" + dataQ)
}

// 更改状态的Api
// export const changeStatusApi = (data: {}) => {
// 	let dataQ = "?" + qsStringify(data)
// 	return request.post("" + dataQ)
// }

// 开启阀门的Api
export const openValveApi = (data: {
	devGId: string | number | null | undefined
	controlId: string | number | null | undefined
}) => {
	let dataQ = "?" + qsStringify(data)
	return request.post("/exc/openValve" + dataQ)
}

// 关闭阀门的Api
export const closeValveApi = (data: {
	devGId: string | number | null | undefined
	controlId: string | number | null | undefined
}) => {
	let dataQ = "?" + qsStringify(data)
	return request.post("/exc/closeValve" + dataQ)
}
